#ifndef COLLECTION_H
#define COLLECTION_H

#include <QList>
#include <QThread>
#include <QMutex>
#include <QWaitCondition>

class DtTrack;
class DtAlbum;
class DtArtist;
class DtGenre;

class Collection : public QThread
{
    Q_OBJECT
private:
    QList<DtTrack *> sTrack;
    QList<DtAlbum *> sAlbum;
    QList<DtArtist *> sArtist;
    QList<DtGenre *> sGenre;
    QMutex mutex;
    QWaitCondition condition;
    bool abort;
public:
    Collection(QObject *parent = 0);
    ~Collection();
    void addCollection();
    QList<DtAlbum *> &getAlbums();
    QList<DtArtist *> &getArtists();
    QList<DtTrack *> &getTracks();
    QList<DtGenre *> &getGenres();
    void addTrack(DtTrack *track, DtAlbum *album, DtArtist *artist,
                  DtGenre *genre);
    DtGenre * getGenreId(const int idGen);
    DtAlbum * getAlbumId(const int idAlb);
    DtArtist * getArtistId(const int idArt);
    DtGenre * getGenre(const DtGenre *genre);
    DtAlbum * getAlbum(const DtAlbum *album);
    DtArtist * getArtist(const DtArtist *artist);
    bool addArtist(DtArtist *artist);
    bool addAlbum(DtAlbum *album);
    bool addGenre(DtGenre *genre);
    void test();

signals:
    void ready();

protected:
    void run();
};

#endif // COLLECTION_H
